<template>
	<view class="contact-circle-container" :style="{paddingTop:statusBarHeight+'rpx'}">
		<view class="contact-header">
			人脉圈
		</view>
		<view class="banner">
			<button class="btn">
				发现更多圈子
			</button>
		</view>
		<view class="content">
			<view class="content-title">
				最近热门
			</view>
			<view class="content-container">
				<view class="content-item" v-for="(item, index) in NetworkCircle"  :key="item.id">
					<view class="item-avatar">
						<image :src="item.picture"></image>
					</view>
					<view class="item-wrapper">
						<view class="item-info">
							<view class="item-title">
								{{item.name}}
							</view>
							<view class="join-count">
								7842人加入
							</view>
							<view class="item-des">
								{{item.introduce}}
							</view>
						</view>
						<view class="follow-wrapper">
							<view class="btn" :class="{followed:item.follow}">
								{{item.follow? "已关注":"关注"}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import api from '@/api/api.js'
	export default {
		data() {
			return {
				statusBarHeight: 0,
				NetworkCircle:[],
			}
		},
		onShow() {
			const res = uni.getSystemInfoSync()
			this.statusBarHeight = res.statusBarHeight
			this.getNetworkCircleList()
		},
		methods: {
			async getNetworkCircleList() {
				const res = await api.NetworkCircle.getNetworkCircleList()
				console.log(res)
				if (res.code === 200) {
					this.NetworkCircle = res.data
				}
			},
			
		}
	}
</script>

<style scoped lang="scss">
	.contact-circle-container{
		padding:0 16rpx;
		box-sizing: border-box;
		.contact-header{
			padding: 40rpx 0;
			box-sizing: border-box;
			font-size: 48rpx;
			font-weight: 600;
		}
		.banner{
			height: 80rpx;
			width: 100%;
			.btn{
				width: 100%;
				height: 100%;
				border-radius: 8rpx;
				background-color: #0CAC42;
				color: white;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 30rpx;
				word-spacing: 2;
			}
		}
		.content{
			.content-title{
				padding: 48rpx 0;
				box-sizing: border-box;
				font-weight: 600;
			}
			.content-container{
				.content-item{
					display: flex;
					align-items: flex-start;
					margin-bottom: 32rpx;
					.item-avatar{
						width: 160rpx;
						height: 200rpx;
						border-radius: 8rpx;
						overflow: hidden;
						// box-shadow: 1rpx 1rpx 10rpx 1rpx #ccc;
						image{
							width: 100%;
							height: 100%;
						}
					}
					.item-wrapper{
						display: flex;
						align-items: center;
						width: 590rpx;
						padding: 8rpx 16rpx 0;
						box-sizing: border-box;
						
						.item-info{
							flex: 1 1 auto;
							overflow: hidden;
							text-overflow: ellipsis;
							padding-right: 16rpx;
							box-sizing: border-box;
							.item-title{
								font-weight: 600;
								margin-bottom: 16rpx;
							}
							.join-count{
								font-size: 24rpx;
								color: #999;
								margin-bottom: 16rpx;
							}
							.item-des{
								font-size: 28rpx;
								color: #666;
								overflow: hidden;
								  text-overflow: ellipsis;
								  display: -webkit-box;
								  -webkit-line-clamp: 2;
								  -webkit-box-orient: vertical;
								  display: -moz-box;
								  -moz-line-clamp: 2;
								  -moz-box-orient: vertical;
								  word-wrap: break-word;
								  word-break: break-all;
								  white-space: normal;    
							}
						}
						.follow-wrapper{
							flex: 0 0 24%;
							.btn{
								font-size: 28rpx;
								color: #079747;
								border: 2rpx solid #079747;
								display: flex;
								justify-content: center;
								align-items: center;
								padding: 4rpx 0;
								font-weight: 600;
								box-sizing: border-box;
								border-radius: 44rpx;
								&.followed{
									color: #666;
									border-color: #666;
								}
							}
						}
					}
				}
			}
		}
	}
</style>
